package cn.edu.scau.cmi.wuzhenxin.spring.client;

import org.springframework.context.ApplicationContext;

import cn.edu.scau.cmi.wuzhenxin.spring.domain.Student;
import cn.edu.scau.cmi.wuzhenxin.spring.domain.Teacher;
import cn.edu.scau.cmi.wuzhenxin.spring.util.ApplicationContextUtil;
import javafx.event.ActionEvent;
import javafx.fxml.FXML;
import javafx.scene.control.Button;
import javafx.scene.control.TextArea;

public class SpringController {
	@FXML
	private TextArea textArea_info;
	@FXML
	private Button btn_show;
	
	private static Teacher teacher;
	private static Student student;
	
	private static ApplicationContext getApplicationContext() {
		ApplicationContext applicationContext=ApplicationContextUtil.getApplicationContext();
//		ApplicationContext ac2=new ClassPathXmlApplicationContext("applicationContext.xml");
		student=(Student) applicationContext.getBean("wuzhenxin");
		
		return applicationContext;
	}
	
	public void show(ActionEvent event) {
		getApplicationContext();
		textArea_info.setText(student.getName()+"的毕业设计指导导师是："+student.getTutor().getName());
	}
	
}
